package com.zijidelu.luframework.starter.beans;

import com.zijidelu.luframework.api.exception.DefaultControllerExceptionHandler;
import com.zijidelu.luframework.api.exception.LuFrameworkControllerExceptionHandler;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * 控制器异常处理自动配置类
 * 负责自动配置控制器异常处理组件
 * 包括默认的控制器异常处理组件 DefaultControllerExceptionHandler
 *
 * @author ZIJIDELU
 * @datetime 2025/11/24 19:17
 */
@AutoConfiguration
public class ControllerExceptionHandlerAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean(LuFrameworkControllerExceptionHandler.class)
    public DefaultControllerExceptionHandler controllerExceptionHandler() {
        return new DefaultControllerExceptionHandler();
    }
}
